package com.cryptoneedle.center.ods.service.ods;

import com.bubbles.engine.data.core.repository.BaseRepository;
import com.bubbles.engine.data.core.service.BaseService;
import com.cryptoneedle.center.common.key.ColumnMappingKey;
import com.cryptoneedle.center.ods.entity.ods.OdsMappingColumn;
import com.cryptoneedle.center.ods.repository.ods.OdsMappingColumnRepository;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>description:  </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-26
 */
@Service
@Slf4j
public class OdsMappingColumnService extends BaseService<OdsMappingColumn, ColumnMappingKey> {

    @Resource
    private OdsMappingColumnRepository odsMappingColumnRepository;

    @Override
    public BaseRepository<OdsMappingColumn, ColumnMappingKey> getRepository() {
        return this.odsMappingColumnRepository;
    }

    @Transactional
    public void deleteByOdsMappingTable(String catalogName, String databaseName, String tableName, String mappingCatalogName, String mappingDatabaseName, String mappingTableName) {
        odsMappingColumnRepository.deleteByOdsMappingTable(catalogName, databaseName, tableName, mappingCatalogName, mappingDatabaseName, mappingTableName);
    }
}